import { TreeNodeData } from '@arco-design/web-vue';
import axios from 'axios';

export function getGoodsCategoryPage(params: any) {
  return axios.get('/mall/goodscategory/page', { params });
}

export function addGoodsCategory(data: any) {
  return axios.post('/mall/goodscategory', data);
}

export function updateGoodsCategory(data: any) {
  return axios.put('/mall/goodscategory', data);
}

/**
 *  注意：这里是反单引号`
 */
export function deleteGoodsCategory(id: string) {
  return axios.delete(`/mall/goodscategory/${id}`);
}

/**
 * 树形类目
 * @returns
 */
export function getGoodsCategoryTree(): Promise<TreeNodeData[]> {
  return axios.get('/mall/goodscategory/tree');
}
